﻿package idv.cjcat.fenofsm.events {
	use namespace ffsm;
	
	import flash.events.*;
	import idv.cjcat.fenofsm.*;
	
	public class StateEvent extends Event {
		/**
		 * The <code>ENTER</code> event is dispatched when the machine enters a new state.
		 */
		public static const ENTER:String = "fsmEnterState";
		/**
		 * The <code>EXIT</code> event is dispatched when the machine leaves a state.
		 */
		public static const EXIT:String = "fsmExitState";
		
		private var _state:State;
		private var _fsm:FSMachine;
		
		public function StateEvent(type:String, state:State) {
			super(type);
			this._state = state;
			this._fsm = state.fsm;
		}
		
		/**
		 * The associated state.
		 */
		public function get state():State { return _state; }
		/**
		 * The associated finite state machine.
		 */
		public function get fsm():FSMachine { return _fsm; }
	}
}